﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class CurrencyData
{
    public int zuanshi=0;
    public int gold=0;
}
public class PlayerData
{
    public string name;
    public int nowLevel;
    public int addSpeedTime;
    public int magnetTime;
}
namespace Assets.Script
{
    public class MainPanelModel : ModelBase
    {
        public static string m_name = null;
        PlayerData p_data;
        CurrencyData m_data;
        public MainPanelModel(string name) : base(name)
        {
            m_name = name;
            ModelManager.Ins.AddModel(this);
            m_data = new CurrencyData();
            p_data = new PlayerData();
            MessageCenter.Ins.ListenMess<CurrencyData>(MessId.RefureCurrencyData, RefureCurrencyData);
        }

        private void RefureCurrencyData(CurrencyData data)
        {
            m_data.zuanshi += data.zuanshi;
            m_data.gold += data.gold;
            MessageCenter.Ins.BuredMess(MessId.RefureCurrencyDataText,m_data);
        }
        public CurrencyData GetData()
        {
            return m_data;
        }
        public void RefurePlayerData(PlayerData data)
        {
            p_data.nowLevel = data.nowLevel;
            p_data.addSpeedTime = data.addSpeedTime;
            p_data.magnetTime = data.magnetTime;
            p_data.name = data.name;
        }
        public PlayerData GetPlayerData()
        {
            return p_data;
        }
    }
}
